﻿using System.Configuration;

namespace TSharp.Core.Mvc.XmlRouting
{
    /// <summary>
    ///     xml路由webconfig设置节
    ///     <para>2010/8/13</para>
    ///     <para>TANGJINGBO</para>
    ///     <para>tangjingbo</para>
    /// </summary>
    internal sealed class MvcRouteConfigurationSection : ConfigurationSection
    {
        /// <summary>
        ///     Gets the ignore.忽略的路由集合
        /// </summary>
        /// <value>The ignore.</value>
        [ConfigurationProperty("ignore", IsRequired = false)]
        public IgnoreCollection Ignore
        {
            get { return (IgnoreCollection) (this["ignore"]); }
        }

        /// <summary>
        ///     Gets the map.路由映射
        /// </summary>
        /// <value>The map.</value>
        [ConfigurationProperty("map", IsRequired = false)]
        public RoutingCollection Map
        {
            get { return (RoutingCollection) (this["map"]); }
        }

        /// <summary>
        ///     Gets the config.
        /// </summary>
        /// <param name="sectionName">The route configuration.</param>
        /// <returns></returns>
        public static MvcRouteConfigurationSection GetConfig(string sectionName)
        {
            return (MvcRouteConfigurationSection) ConfigurationManager.GetSection(sectionName);
        }
    }
}